<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head >
    <meta charset="UTF-8">
    <title>Title</title>

    <link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.2/css/bootstrap.min.css">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>

<body>
    <div heigth="auto" th:replace="fragments/header :: navbar"></div>

    <div th:fragment="bookForm" class="container p-5">
        <h3 class="text-center  ">欢迎注册在线书店系统</h3>
        <div class="row justify-content-center">
            <div class="col-4">
                <div class="alert alert-success" th:if="${successMessage}" th:utext="${successMessage}"></div>
                <form class="register-form" name="form" role="form" th:action="@{/registration}" th:object="${user}" method="post">
                    <div class="form-group">
                        <label class="form-control-label" for="login">用户名:</label>
                        <input type="text" class="form-control" id="login" name="login"
                            th:field="*{userName}" required
                               minlength="1" maxlength="50"
                               pattern="^[_'.@A-Za-z0-9-]*$">
                        <div th:if="${#fields.hasErrors('userName')}">
                            <small class="form-text text-danger" th:errors="*{userName}"></small>
                        </div>
                    </div>
                    <div class="form-group" >
                        <label class="form-control-label" for="password">密&nbsp&nbsp&nbsp&nbsp码:</label>
                        <input type="password" class="form-control" id="password" name="password"
                            th:field="*{userPassword}" minlength="4" max="50" required>
                        <div th:if="${#fields.hasErrors('userPassword')}">
                            <small class="form-text text-danger" th:errors="*{userPassword}"></small>
                        </div>
                    </div>
                    <div class="pt-2" >
                        <a class="btn btn-primary" th:href="@{/}">返回首页</a>
                        <button class="btn btn-primary" type="submit">用户注册</button>
                    </div>


                </form>
            </div>
        </div>
    </div>

</body>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js" integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js" integrity="sha384-ep+dxp/oz2RKF89ALMPGc7Z89QFa32C8Uv1A3TcEK8sMzXVysblLA3+eJWTzPJzT" crossorigin="anonymous"></script>


</html>